import Vue from 'vue'
import App from './App.vue'
import router from '@/router'
import store from '@/store'
import common from '@/libs/common'
import config from '@/config'
import Vant from 'vant'
import 'vant/lib/index.css'
import VueWechatTitle from 'vue-wechat-title'
import VueValidator from 'vue-validator'
import './libs/rem'
import VueLazyload from 'vue-lazyload'
import AMapLoader from '@amap/amap-jsapi-loader'
// import Calendar from 'vue-mobile-calendar'

// import hdMobilePluginGather from 'hd-mobile-plugin-gather'
// import 'hd-mobile-plugin-gather/lib/hd-mobile-plugin-gather.css'
// import hdSstMobileBase from 'hd-sst-mobile-base'
// import 'hd-sst-mobile-base/lib/hd-sst-mobile-base.css'
// import VConsole from 'vconsole'
// import HDSDK from 'hd-app-js-sdk'
// import { Toast } from 'vant'
// import axios from 'axios'
// if (config.debug) {
//   let a = new VConsole()
//   console.log(a)
// }
// -----------------------
// 设置高德地图安全密钥
window._AMapSecurityConfig = {
  securityJsCode: '0ff264e7cf5ad571fb27eea68f9dcb2a'
}
AMapLoader.load({
  'key': '42c5bd81d98011ec6be3343e8f6579e2',
  'version': '2.0', // 指定要加载的 JSAPI 的版本，缺省时默认为 1.4.15
  'plugins': ['AMap.Geolocation', 'AMap.CitySearch']// 需要使用的的插件列表，如比例尺'AMap.Scale'等
})
if (process.env.NODE_ENV !== 'production') require('@/mock')
// Vue.use(Toast)
Vue.use(Vant)
Vue.use(VueWechatTitle)
Vue.use(AMapLoader)
Vue.use(VueValidator)
// Vue.use(hdMobilePluginGather)
// Vue.use(hdSstMobileBase, {})
// Vue.use(Toast)
// Vue.use(Calendar)
Vue.use(VueLazyload, {
  lazyComponent: true
})

Vue.config.productionTip = false
Vue.prototype.$common = common
Vue.prototype.$config = config
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0)
})
// Toast.loading({
//   message: '加载中...',
//   forbidClick: false,
//   loadingType: 'spinner',
//   duration: 10000
// })
// axios.request({ url: '/api/uc/csc/qstbMobileService/getSSTSign' }).then(r => {
//   // Toast.clear()
//   const result = r.data.data // 返回数据
//   console.log(result.data, 'result111111')
//   delete r.data.url // 删除返回数据中的url字段
//   Vue.prototype.$hdsdk = new HDSDK(result.data) // 构造sdk实例，并挂载到vue原型
// // 也可以不挂载到vue原型，看项目实际需求
// })
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
